fix test_named_agents by writing fake agent PATH to shell RC file#93
Merged
raine merged 4 commits intoraine:mainfrom Apr 3, 2026
Merged
fix test_named_agents by writing fake agent PATH to shell RC file#93raine merged 4 commits intoraine:mainfrom
raine merged 4 commits intoraine:mainfrom
Conversation
d9b64a1 to
9fcae27
Compare
New tmux panes start a fresh shell that sources .zshrc/.bashrc, so fake agent binaries must be on PATH there — not just in the tmux global environment. Matches the pattern used by test_agents.py. Co-Authored-By: Trent Davies <trentdavies@users.noreply.github.com>
FakeAgentInstaller relied on each test manually writing the fake bin directory to shell RC files so new tmux panes would find the fake agent. Tests in test_named_agents.py and test_layouts.py forgot this step, which could cause failures on machines where a real agent binary exists in a system PATH directory (path_helper reorders PATH in login shells). MuxEnvironment.__init__ now creates a shared fake-bin directory and writes base RC files for all supported shells (bash, zsh, fish, nu) that prepend it to PATH. FakeAgentInstaller.install() simply drops scripts into this already-active directory. Tests that wrote RC files only for PATH are simplified (removed the manual writes). Tests that wrote additional RC content (aliases, env vars, markers) now append instead of overwrite.
Use the existing SHELL_NAMES constant instead of a hardcoded list when writing base RC files in MuxEnvironment.__init__. Export SHELL in the wrapper script built by run_workmux_command() so that WezTerm shell-parametrized tests propagate the configured shell to the workmux subprocess. Previously configure_default_shell() set env["SHELL"] but run_workmux_command() never exported it.
9fcae27 to
d74c735
Compare
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix test_named_agents failures
The two
TestKnownAgentAutoDetectiontests intest_named_agents.pyfail on machines that have Claude Code installed because the realclaudebinary runs instead of the fake test script.Root cause
New tmux panes start a fresh shell that sources
.zshrc/.bashrc. The fake agent binary was only added to PATH viatmux set-environment -gand the subprocess environment, but new pane shells don't inherit from either — they get PATH from their shell profile.The passing tests in
test_agents.pyalready handle this correctly by writing the fake PATH into a shell RC file.test_named_agents.pywas missing this step, so I implemented it sojust teston Mac succeeds.Fix
Added
_write_rc_with_fake_path()helper that writesexport PATH="<fake-bin-dir>:$PATH"to the shell RC file, so new tmux panes find the fake agent binary first. Matches the existing pattern intest_agents.py.Test plan
pytest tests/test_workmux_add/test_named_agents.py— both tests passjust test— 328/328 pass, 0 failures